﻿using OS.Common.Enums;

namespace OS.Common.Plugs.LogPlug
{
    /// <summary>
    /// 日志实体
    /// </summary>
    public sealed class LogInfo
    {
        /// <summary>
        /// 日志等级
        /// </summary>
        public LogLevelEnum Level
        {
            get;
            set;
        }

        /// <summary>
        /// 日志类型
        /// </summary>
        public string ModuleName
        {
            get;
            set;
        }

        /// <summary>
        ///   key值  可以是自定义的标识  
        ///   根据此字段可以处理当前module下不同复杂日志信息
        /// </summary>
        public string MsgKey
        {
            get;
            set;
        }

        /// <summary>
        /// 日志信息  可以是复杂类型  如 具体实体类
        /// </summary>
        public object Msg
        {
            get;
            set;
        }

        /// <summary>
        /// 编号（全局唯一）
        /// </summary>
        public string LogCode
        {
            get;
            set;
        }

        /// <summary>
        /// 空构造函数
        /// </summary>
        public LogInfo()
        {
        }

        /// <summary>
        /// 日志构造函数
        /// </summary>
        /// <param name="loglevel"></param>
        /// <param name="logMsg"></param>
        /// <param name="msgKey"></param>
        /// <param name="moduleName"></param>
        internal LogInfo(LogLevelEnum loglevel, object logMsg, string msgKey = null, string moduleName = "default")
        {
            Level = loglevel;
            ModuleName = moduleName;
            Msg = logMsg;
            MsgKey = msgKey;
        }
    }
}